﻿Imports System.Xml
''' <summary>
''' PUT相关语句
''' </summary>
''' <remarks></remarks>
Public Class clsStatementPut
    ''' <summary>
    ''' 是否为PUT语句
    ''' </summary>
    ''' <param name="CurrentText"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function IsStatement(ByVal CurrentText As String) As XmlElement
        Dim strTokens As List(Of String) = GetSyntaxToken(CurrentText)
        'PUT EDIT / PUT DATA / PUT LIST
        If CurrentText.StartsWith("PUT ") Then
            Dim PutXml As XmlElement = mXmlDocument.CreateElement("PUT")
            '是否换行
            If HasTOKEN("SKIP", strTokens) Then
                PutXml.SetAttribute("SKIP", 1)
            End If
            '是否换复数行
            If HasTokenStartWith("SKIP(", strTokens) Then
                PutXml.SetAttribute("SKIP", GetAttr("SKIP", strTokens))
            End If
            '是否换页
            If HasTOKEN("PAGE", strTokens) Then
                PutXml.SetAttribute("PAGE", True)
            End If
            '是否写入文件
            If HasTokenStartWith("FILE(", strTokens) Then
                PutXml.SetAttribute("FILE", GetAttr("FILE", strTokens))
            End If
            'PUT语句类型
            Select Case True
                Case HasTokenStartWith("LIST(", strTokens)
                    PutXml.SetAttribute("TYPE", "LIST")
                    PutXml.SetAttribute("DATALIST", GetAttr("LIST", strTokens))
                Case HasTokenStartWith("EDIT(", strTokens)
                    PutXml.SetAttribute("TYPE", "EDIT")
                    PutXml.SetAttribute("DATALIST", GetAttr("EDIT", strTokens))
                    '带有() 的TOKEN为DATALIST
                    For Each Token As String In strTokens
                        If Token.StartsWith("(") And Token.EndsWith(")") Then
                            PutXml.SetAttribute("FORMATLIST", Mid(Token, 2, Token.Length - 2))
                            Exit For
                        End If
                    Next
                Case HasTokenStartWith("DATA(", strTokens)
                    PutXml.SetAttribute("TYPE", "DATA")
                    PutXml.SetAttribute("DATALIST", GetAttr("DATA", strTokens))
                Case Else
                    '没有关键字LIST，EDIT，DATA的时候，LIST是默认类型
                    PutXml.SetAttribute("TYPE", "LIST")
            End Select
            Return PutXml
        Else
            Return Nothing
        End If
    End Function
    ''' <summary>
    ''' PUT语句的调整
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function JustifyPut(ByVal PutNode As XmlElement) As clsStatementBlock
        '返回块
        Dim rtnStatement As New clsStatementBlock
        '存放数据的数组
        Dim strDataArray As String() = StringHelper.GetSubLinesBySplitMark(PutNode.GetAttribute("DATALIST"), ",", SplitStyle.NoSplitMark).ToArray
        Dim FormatList As New List(Of String)
        If PutNode.GetAttribute("FORMATLIST") <> String.Empty Then
            '存放格式的数组
            Dim strFormatArray As String()
            strFormatArray = StringHelper.GetSubLinesBySplitMark(PutNode.GetAttribute("FORMATLIST"), ",", SplitStyle.NoSplitMark).ToArray
            '将 2 A 这样的格式整理为 A,A
            For Each strT As String In strFormatArray
                Dim TempToken As List(Of String) = GetSyntaxToken(strT)
                If TempToken.Count = 2 AndAlso IsNumeric(TempToken(0)) Then
                    For i As Byte = 1 To TempToken(0)
                        FormatList.Add(TempToken(1))
                    Next
                Else
                    FormatList.Add(strT)
                End If
            Next
        End If
        '各个打印行的格式数据
        Dim OutPutLineList As New List(Of clsOutPutLine)
        '每个行的格式
        Dim SingleFormatLine As New List(Of String)
        '每个行的数据
        Dim SingleDataLine As New List(Of String)
        Dim PutOutTab As Byte = 24
        '将PUT LIST 转换为PUT EDIT
        If PutNode.GetAttribute("TYPE") = "LIST" Then
            For DataIndex As Byte = 0 To strDataArray.Length - 1
                Select Case DataIndex Mod 5
                    Case 0
                        '第1,6，11个数据
                        FormatList.Add("A")
                    Case 4
                        '第5,10,15 个数据
                        FormatList.Add("COL(" & PutOutTab * (DataIndex Mod 5) - 1 & ")")
                        FormatList.Add("A")
                        FormatList.Add("SKIP")
                    Case Else
                        FormatList.Add("COL(" & PutOutTab * (DataIndex Mod 5) - 1 & ")")
                        FormatList.Add("A")
                End Select
            Next
        End If

        '如果是DATA的话，当做一个单独的 A 格式来处理
        If PutNode.GetAttribute("TYPE") = "DATA" Then
            For Each DataItem In strDataArray
                FormatList.Add("A")
            Next
        End If

        '放在最后的SKIP是没有作用的
        If FormatList.Count > 0 Then
            If FormatList.Item(FormatList.Count - 1) = "SKIP" Or _
               FormatList.Item(FormatList.Count - 1).StartsWith("SKIP(") Then
                FormatList.RemoveAt(FormatList.Count - 1)
            End If
        End If

        Dim OutPutDataIndex As Byte
        '对于SKIP的整理
        For Each strFormat As String In FormatList
            SingleFormatLine.Add(strFormat)
            If strFormat = "SKIP" Or strFormat.StartsWith("SKIP(") Then
                '先通过SKIP，或者SKIP(N)，统计出需要输入的行数
                OutPutLineList.Add(New clsOutPutLine(SingleDataLine, SingleFormatLine))
                SingleFormatLine.Clear()
                SingleDataLine.Clear()
            Else
                If Not (strFormat.StartsWith("COL(") Or strFormat.StartsWith("COLUMN(") Or _
                        strFormat = "X" Or strFormat.StartsWith("X(")) Then
                    SingleDataLine.Add(strDataArray(OutPutDataIndex))
                    OutPutDataIndex += 1
                End If
            End If
        Next
        '最后一行的处理
        If SingleFormatLine.Count > 0 Then
            OutPutLineList.Add(New clsOutPutLine(SingleDataLine, SingleFormatLine))
            SingleFormatLine.Clear()
            SingleDataLine.Clear()
        End If

        '对于每行进行操作
        For Each SingleLine As clsOutPutLine In OutPutLineList
            Dim PutStatement As clsStatementBlock = clsOutPutLine.ProcessSingleLine(SingleLine)
            For Each oprPut As XmlElement In PutStatement.SingleStatementList
                Select Case oprPut.Name
                    Case "IF"
                        Dim mIFNode As IFNode
                        mIFNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        rtnStatement.AddIF(mIFNode)
                    Case "LOOP"
                        Dim mLoopNode As LoopNode
                        mLoopNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        mLoopNode.SetCommentList()
                        rtnStatement.AddLoop(mLoopNode)
                    Case "SELECT"
                        Dim mSELECTNode As SelectNode
                        mSELECTNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        mSELECTNode.SetCommentList()
                        rtnStatement.AddSelect(mSELECTNode)
                    Case Else
                        If PutNode.ChildNodes.Count > 0 Then
                            For Each CommentXml As XmlElement In PutNode.ChildNodes
                                oprPut.AppendChild(CommentXml.Clone)
                            Next
                            PutNode.RemoveAll()
                        End If
                        rtnStatement.AddOperation(oprPut)
                End Select
            Next
        Next
        Return rtnStatement
    End Function
End Class
''' <summary>
''' GET相关语句
''' </summary>
''' <remarks></remarks>
Public Class clsStatementGet
    ''' <summary>
    ''' PUT语句的调整
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function JustifyGet(ByVal PutNode As XmlElement) As clsStatementBlock
        '返回块
        Dim rtnStatement As New clsStatementBlock
        '存放数据的数组
        Dim strDataArray As String() = StringHelper.GetSubLinesBySplitMark(PutNode.GetAttribute("DATALIST"), ",", SplitStyle.NoSplitMark).ToArray
        Dim FormatList As New List(Of String)
        If PutNode.GetAttribute("FORMATLIST") <> String.Empty Then
            '存放格式的数组
            Dim strFormatArray As String()
            strFormatArray = StringHelper.GetSubLinesBySplitMark(PutNode.GetAttribute("FORMATLIST"), ",", SplitStyle.NoSplitMark).ToArray
            '将 2 A 这样的格式整理为 A,A
            For Each strT As String In strFormatArray
                Dim TempToken As List(Of String) = GetSyntaxToken(strT)
                If TempToken.Count = 2 AndAlso IsNumeric(TempToken(0)) Then
                    For i As Byte = 1 To TempToken(0)
                        FormatList.Add(TempToken(1))
                    Next
                Else
                    FormatList.Add(strT)
                End If
            Next
        End If
        '各个打印行的格式数据
        Dim OutPutLineList As New List(Of clsOutPutLine)
        '每个行的格式
        Dim SingleFormatLine As New List(Of String)
        '每个行的数据
        Dim SingleDataLine As New List(Of String)
        Dim PutOutTab As Byte = 24
        '将PUT LIST 转换为PUT EDIT
        If PutNode.GetAttribute("TYPE") = "LIST" Then
            For DataIndex As Byte = 0 To strDataArray.Length - 1
                Select Case DataIndex Mod 5
                    Case 0
                        '第1,6，11个数据
                        FormatList.Add("A")
                    Case 4
                        '第5,10,15 个数据
                        FormatList.Add("COL(" & PutOutTab * (DataIndex Mod 5) - 1 & ")")
                        FormatList.Add("A")
                        FormatList.Add("SKIP")
                    Case Else
                        FormatList.Add("COL(" & PutOutTab * (DataIndex Mod 5) - 1 & ")")
                        FormatList.Add("A")
                End Select
            Next
        End If

        If PutNode.GetAttribute("TYPE") = "DATA" Then
            For Each DataItem In strDataArray
                FormatList.Add("A")
            Next
        End If

        '放在最后的SKIP是没有作用的
        If FormatList.Count > 0 Then
            If FormatList.Item(FormatList.Count - 1) = "SKIP" Or _
               FormatList.Item(FormatList.Count - 1).StartsWith("SKIP(") Then
                FormatList.RemoveAt(FormatList.Count - 1)
            End If
        End If

        Dim OutPutDataIndex As Byte
        '对于SKIP的整理
        For Each strFormat As String In FormatList
            SingleFormatLine.Add(strFormat)
            If strFormat = "SKIP" Or strFormat.StartsWith("SKIP(") Then
                '先通过SKIP，或者SKIP(N)，统计出需要输入的行数
                OutPutLineList.Add(New clsOutPutLine(SingleDataLine, SingleFormatLine))
                SingleFormatLine.Clear()
                SingleDataLine.Clear()
            Else
                If Not (strFormat.StartsWith("COL(") Or strFormat.StartsWith("COLUMN(") Or _
                        strFormat = "X" Or strFormat.StartsWith("X(")) Then
                    SingleDataLine.Add(strDataArray(OutPutDataIndex))
                    OutPutDataIndex += 1
                End If
            End If
        Next
        '最后一行的处理
        If SingleFormatLine.Count > 0 Then
            OutPutLineList.Add(New clsOutPutLine(SingleDataLine, SingleFormatLine))
            SingleFormatLine.Clear()
            SingleDataLine.Clear()
        End If

        '对于每行进行操作
        For Each SingleLine As clsOutPutLine In OutPutLineList
            Dim PutStatement As clsStatementBlock = clsOutPutLine.ProcessSingleLine(SingleLine)
            For Each oprPut As XmlElement In PutStatement.SingleStatementList
                Select Case oprPut.Name
                    Case "IF"
                        Dim mIFNode As IFNode
                        mIFNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        rtnStatement.AddIF(mIFNode)
                    Case "LOOP"
                        Dim mLoopNode As LoopNode
                        mLoopNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        mLoopNode.SetCommentList()
                        rtnStatement.AddLoop(mLoopNode)
                    Case "SELECT"
                        Dim mSELECTNode As SelectNode
                        mSELECTNode = PutStatement.BlockOprList(CInt(oprPut.GetAttribute("BLOCKINDEX")))
                        mSELECTNode.SetCommentList()
                        rtnStatement.AddSelect(mSELECTNode)
                    Case Else
                        If PutNode.ChildNodes.Count > 0 Then
                            For Each CommentXml As XmlElement In PutNode.ChildNodes
                                oprPut.AppendChild(CommentXml.Clone)
                            Next
                            PutNode.RemoveAll()
                        End If
                        rtnStatement.AddOperation(oprPut)
                End Select
            Next
        Next
        Return rtnStatement
    End Function
    ''' <summary>
    ''' 是否为GET命令
    ''' </summary>
    ''' <param name="CurrentText"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function IsStatement(ByVal CurrentText As String) As XmlElement
        Dim strTokens As List(Of String) = GetSyntaxToken(CurrentText)
        'GET EDIT / GET DATA / GET LIST
        If CurrentText.StartsWith("GET ") Then
            Dim PutXml As XmlElement = mXmlDocument.CreateElement("GET")
            '是否换行
            If HasTOKEN("SKIP", strTokens) Then
                PutXml.SetAttribute("SKIP", 1)
            End If
            '是否换复数行
            If HasTokenStartWith("SKIP(", strTokens) Then
                PutXml.SetAttribute("SKIP", GetAttr("SKIP", strTokens))
            End If
            '是否换页
            If HasTOKEN("PAGE", strTokens) Then
                PutXml.SetAttribute("PAGE", True)
            End If
            '是否写入文件
            If HasTokenStartWith("FILE(", strTokens) Then
                PutXml.SetAttribute("FILE", GetAttr("FILE", strTokens))
            End If
            'PUT语句类型
            Select Case True
                Case HasTokenStartWith("LIST(", strTokens)
                    PutXml.SetAttribute("TYPE", "LIST")
                    PutXml.SetAttribute("DATALIST", GetAttr("LIST", strTokens))
                Case HasTokenStartWith("EDIT(", strTokens)
                    PutXml.SetAttribute("TYPE", "EDIT")
                    PutXml.SetAttribute("DATALIST", GetAttr("EDIT", strTokens))
                    '带有() 的TOKEN为DATALIST
                    For Each Token As String In strTokens
                        If Token.StartsWith("(") And Token.EndsWith(")") Then
                            PutXml.SetAttribute("FORMATLIST", Mid(Token, 2, Token.Length - 2))
                            Exit For
                        End If
                    Next
                Case HasTokenStartWith("DATA(", strTokens)
                    PutXml.SetAttribute("TYPE", "DATA")
                    PutXml.SetAttribute("DATALIST", GetAttr("DATA", strTokens))
                Case Else
                    '没有关键字LIST，EDIT，DATA的时候，LIST是默认类型
                    PutXml.SetAttribute("TYPE", "LIST")
            End Select
            Return PutXml
        Else
            Return Nothing
        End If
    End Function
End Class
''' <summary>
''' 每一个输出行的信息
''' </summary>
''' <remarks></remarks>
Public Class clsOutPutLine
    '改行数(可能出现变量，所以设为字符型)
    Public SkipCount As String = String.Empty
    ''' <summary>
    ''' 输出内容
    ''' </summary>
    ''' <remarks></remarks>
    Public ContentList As New List(Of struContent)
    '数据和格式的结构体
    Public Structure struContent
        Dim Format As String
        Dim Data As String
    End Structure
    ''' <summary>
    ''' 构造器
    ''' </summary>
    ''' <param name="DataList"></param>
    ''' <param name="FormatList"></param>
    ''' <remarks></remarks>
    Public Sub New(ByVal DataList As List(Of String), ByVal FormatList As List(Of String))
        ''将每一行进行COL单位的整理
        ''每个COL单位包括 开始位置，格式，数据，长度
        Select Case True
            Case DataList.Count = 0 And FormatList.Count = 1
                '1.如果原来格式一开始是一个SKIP的话，则仅表示一个空行，（DataList为空，FormatList为SKIP）
                If FormatList(0) = "SKIP" Then SkipCount = 1
                If FormatList(0).StartsWith("SKIP(") Then
                    SkipCount = Mid(FormatList(0), 6, FormatList(0).Length - 6)
                End If
            Case Else
                Dim OutPutPos As Integer = 1
                Dim ProcessDataIndex As Byte = 0
                For Each strFormat As String In FormatList
                    Select Case True
                        Case strFormat.StartsWith("COL(") Or strFormat.StartsWith("COLUMN(")
                            '输出位置控制
                            Dim ColPos As Integer
                            If strFormat.StartsWith("COL(") Then
                                ColPos = Mid(strFormat, 5, strFormat.Length - 5)
                            Else
                                ColPos = Mid(strFormat, 8, strFormat.Length - 8)
                            End If
                            If OutPutPos <> ColPos Then
                                Dim SpaceFiller As New struContent
                                SpaceFiller.Format = "X(" & ColPos - OutPutPos & ")"
                                ContentList.Add(SpaceFiller)
                                OutPutPos = ColPos
                            End If
                        Case strFormat = "SKIP" Or strFormat.StartsWith("SKIP(")
                            '换行控制
                            If strFormat = "SKIP" Then SkipCount = 1
                            If strFormat.StartsWith("SKIP(") Then
                                SkipCount = Mid(strFormat, 6, strFormat.Length - 6)
                            End If
                        Case strFormat = "X" Or strFormat.StartsWith("X(")
                            '空格，只有格式，没有数据
                            Dim mContent As New struContent
                            mContent.Format = strFormat
                            ContentList.Add(mContent)
                            If strFormat = "X" Then
                                OutPutPos += 1
                            Else
                                OutPutPos += Mid(strFormat, 3, strFormat.Length - 3)
                            End If
                        Case Else
                            'A，F，既有格式，也有数据
                            Dim mContent As New struContent
                            mContent.Format = strFormat
                            mContent.Data = DataList(ProcessDataIndex)
                            ContentList.Add(mContent)
                            OutPutPos += GetLengthByConent(mContent)
                            ProcessDataIndex += 1
                    End Select
                Next
        End Select
    End Sub
    ''' <summary>
    ''' 根据内容获得长度
    ''' </summary>
    ''' <param name="Content"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Shared Function GetLengthByConent(ByVal Content As struContent) As Integer
        Select Case True
            Case Content.Format = "X"
                Return 1
            Case Content.Format.StartsWith("X(")
                Return Mid(Content.Format, 3, Content.Format.Length - 3)
            Case Content.Format = "A"
                If Content.Data.StartsWith("'") And Content.Data.EndsWith("'") Then
                    Return Content.Data.Length
                Else
                    Dim VarName As String = Content.Data.Split(".")(Content.Data.Split(".").Length - 1)
                    Dim RefDataXml As XmlElement = clsDataAssist.GetDataItemByDataName(VarName)
                    If Not RefDataXml Is Nothing Then
                        Return RefDataXml.GetAttribute("LENGTH")
                    End If
                End If
            Case Content.Format.StartsWith("A(")
                Return Mid(Content.Format, 3, Content.Format.Length - 3)
            Case Content.Format = "F"
                Dim VarName As String = Content.Data.Split(".")(Content.Data.Split(".").Length - 1)
                Dim RefDataXml As XmlElement = clsDataAssist.GetDataItemByDataName(VarName)
                If Not RefDataXml Is Nothing Then
                    Return RefDataXml.GetAttribute("LENGTH")
                End If
            Case Content.Format.StartsWith("F(")
                Return Mid(Content.Format, 3, Content.Format.Length - 3)
            Case Content.Format.StartsWith("P'")
                Return Content.Format.Length - 3
        End Select
        Return 0
    End Function
    ''' <summary>
    ''' 处理每一行
    ''' </summary>
    ''' <param name="SingleLine">行信息</param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function ProcessSingleLine(ByVal SingleLine As clsOutPutLine) As clsStatementBlock
        Dim PreProcess As New clsStatementBlock
        Dim AfterProcess As New clsStatementBlock
        Dim rtnStatement As New clsStatementBlock
        Dim DisplayXml As XmlElement = mXmlDocument.CreateElement("DISPLAY")
        If SingleLine.ContentList.Count = 1 Then
            '只有一个数据的情况
            Dim SingleContent As clsOutPutLine.struContent = SingleLine.ContentList(0)
            If SingleContent.Format = "A" Or SingleContent.Format = "F" Then
                Dim ValueXml As XmlElement = mXmlDocument.CreateElement("DATAITEM")
                ValueXml.SetAttribute("VALUE", clsJustifyStatement.ModifySubExpress(SingleContent.Data, PreProcess, AfterProcess))
                DisplayXml.AppendChild(ValueXml)
            Else
                '增加一个数据项
                Dim MsgXml As XmlElement = mXmlDocument.CreateElement("SINGLEDATA")
                MsgXml.SetAttribute("NAME", "WK_MSG_" & mDataNode.MsgList.Count + 1)
                MsgXml = GetDataXml(MsgXml, SingleContent)
                MsgXml.SetAttribute("LayNo", 1)
                '将输入值放入这个数据项
                Dim MoveXml As XmlElement = mXmlDocument.CreateElement("MOVE")
                MoveXml.SetAttribute("TARGET", "WK_MSG_" & mDataNode.MsgList.Count + 1)
                MoveXml.SetAttribute("SOURCE", clsJustifyStatement.ModifySubExpress(SingleContent.Data, PreProcess, AfterProcess))
                PreProcess.AddOperation(MoveXml)
                mDataNode.MsgList.Add(MsgXml)
                Dim ValueXml As XmlElement = mXmlDocument.CreateElement("DATAITEM")
                ValueXml.SetAttribute("VALUE", "WK_MSG_" & mDataNode.MsgList.Count)
                DisplayXml.AppendChild(ValueXml)
            End If
        Else
            '有多个数据的情况
            Dim MsgXml As XmlElement = mXmlDocument.CreateElement("TREEDATA")
            MsgXml.SetAttribute("LayNo", 1)
            MsgXml.SetAttribute("NAME", "WK_MSG_" & mDataNode.MsgList.Count + 1)
            Dim ValueXml As XmlElement = mXmlDocument.CreateElement("DATAITEM")
            ValueXml.SetAttribute("VALUE", "WK_MSG_" & mDataNode.MsgList.Count + 1)
            For i As Integer = 0 To SingleLine.ContentList.Count - 1
                Dim SubData As XmlElement = mXmlDocument.CreateElement("SINGLEDATA")
                SubData.SetAttribute("NAME", "MSGITEM_" & i + 1)
                SubData = GetDataXml(SubData, SingleLine.ContentList(i))
                SubData.SetAttribute("LayNo", 3)
                MsgXml.AppendChild(SubData)
                If SingleLine.ContentList(i).Data <> "" Then
                    Dim MoveXml As XmlElement = mXmlDocument.CreateElement("MOVE")
                    MoveXml.SetAttribute("TARGET", "MSGITEM_" & i + 1)
                    MoveXml.SetAttribute("SOURCE", clsJustifyStatement.ModifySubExpress(SingleLine.ContentList(i).Data, PreProcess, AfterProcess))
                    PreProcess.AddOperation(MoveXml)
                End If
            Next
            mDataNode.MsgList.Add(MsgXml)
            DisplayXml.AppendChild(ValueXml)
        End If
        MergeStatementBlock(PreProcess, rtnStatement)
        rtnStatement.AddOperation(DisplayXml)
        MergeStatementBlock(rtnStatement, AfterProcess)
        '对于SKIP的处理
        If Not (SingleLine.SkipCount = "1" Or SingleLine.SkipCount = String.Empty) Then
            Dim SkipLoop As New LoopNode
            SkipLoop.LoopVarName = "WK_PLI_COMMON"
            If IsNumeric(SingleLine.SkipCount) Then
                SkipLoop.LoopTo = SingleLine.SkipCount - 1
            Else
                SkipLoop.LoopTo = SingleLine.SkipCount & "- 1"
            End If
            Dim DisplaySkipXml As XmlElement = mXmlDocument.CreateElement("DISPLAY")
            Dim SkipValue As XmlElement = mXmlDocument.CreateElement("DATAITEM")
            SkipValue.SetAttribute("VALUE", "' '")
            DisplaySkipXml.AppendChild(SkipValue)
            SkipLoop.LoopList.AddOperation(DisplaySkipXml)
            rtnStatement.AddLoop(SkipLoop)
        End If
        Return rtnStatement
    End Function
    ''' <summary>
    ''' 根据内容获得临时数据
    ''' </summary>
    ''' <param name="Content"></param>
    ''' <remarks></remarks>
    Public Shared Function GetDataXml(ByVal DataXml As XmlElement, ByVal Content As clsOutPutLine.struContent) As XmlElement
        Select Case True
            Case Content.Format.StartsWith("X")
                DataXml.SetAttribute("TYPE", "CHAR")
            Case Content.Format.StartsWith("X(")
                DataXml.SetAttribute("TYPE", "CHAR")
            Case Content.Format = "A"
                DataXml.SetAttribute("TYPE", "CHAR")
            Case Content.Format.StartsWith("A(")
                DataXml.SetAttribute("TYPE", "CHAR")
            Case Content.Format.StartsWith("F(")
                DataXml.SetAttribute("TYPE", "FIXED DEC")
            Case Content.Format.StartsWith("P'")
                DataXml.SetAttribute("TYPE", "PIC")
                DataXml.SetAttribute("PIC", Mid(Content.Format, 3, Content.Format.Length - 3))
                DataXml.SetAttribute("LayNo", 3)
                DataXml = PIC_DataItem.JustifyPIC(DataXml)
        End Select
        DataXml.SetAttribute("LENGTH", clsOutPutLine.GetLengthByConent(Content))
        Return DataXml
    End Function
End Class
